<%@ page contentType="text/html; charset=UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src='<%=request.getContextPath()%>/dwr/engine.js'> </script>
<script type="text/javascript" src='<%=request.getContextPath()%>/lovejes/lovejes.js'> </script>
<script type="text/javascript">
JesUpload = {
	//upload_import.jsp上传页面
	uploadAgain : function(){
		$("attachfile").outerHTML  = $("attachfile").outerHTML;
		JESUtil.hide("procBar");
	}
	,doUpload : function(){
		if($("attachfile").value == ""){
			alert("上传附件不能为空！");
			return;
		}
		JESUtil.show("procBar");
    	$("procBarTxt").innerHTML = "上传进度: 0%";
    	$("procBarBoxCont").style.width = "0px";
    	JESUtil.disBtns();
    	window.setTimeout("JesUpload._reProcess()", 1000);
    	//return true;
		form1.submit();
	}
	,_reProcess : function(){
		JESExtUtil.doAction("getBussInfo","UPPROC_INFO",function(_d){
			if(_d.isProcess){
				$("procBarTxt").innerHTML = _d.procInfo;
				$("procBarBoxCont").style.width = parseInt(_d.procPer * 2.16) + "px";
				window.setTimeout("JesUpload._reProcess()", 100);
			}else{
				$("procBarBoxCont").style.width = "216px";
				$("procBarTxt").innerHTML = "<p><font color='red'>"+_d.procInfo+"</font></p><p><input type='button' value='继续上传' onclick='JesUpload.uploadAgain();'/>&nbsp;&nbsp;<input type='button' value='关 闭' onclick=\"JESUtil.closeWin();\"/></p>";
				JESUtil.disBtns(false);
			}
		});
	}
}


//--------------------------------------------------------------------------------------------------------------------------------------------------
//upload_response.jsp

/**
* @todo：上传后返回*方法自定义重写
* @date：2008-7-28 16:54
* @author：hyh
*/
function callUploadback(oAttachment){
	var attachTableName = "table_query1";
	var _attach_table = null;
	if(opener) _attach_table = opener.$("_attach_tablename");//放入隐藏域中
	else _attach_table = window.dialogArguments.$("_attach_tablename");
	if(_attach_table) attachTableName = _attach_table.value;
	var tableEle = null;
	if(opener) tableEle = opener.$(attachTableName);
	else tableEle = window.dialogArguments.$(attachTableName);
	try{
		if(oAttachment.attachtype.indexOf("pic") != -1){
	  		var tr = tableEle.insertRow(tableEle.rows.length);
	        var td = tr.insertCell(tr.cells.length);
			td.align = "center";
			td.height = 30;
			td.bgColor = "#ffffff";
			td.innerHTML = "<img src='"+oAttachment.httppath+"pic/"+oAttachment.attachname +"'><input type='hidden' id='_uploadname' name='_uploadname' value='"+oAttachment.attachname+"'/>";
			//td.innerHTML = "<img src='"+oAttachment.httppath+"pic/test.jpg'><input type='hidden' id='_uploadname' name='_uploadname' value='"+oAttachment.uploadname+"'/>";
			//td.innerHTML = "<img src='/dianping/upload/test.jpg'><input type='hidden' id='uploadname' name='uploadname' value='"+oAttachment.uploadname+"'/>";
			td = tr.insertCell(tr.cells.length);
			td.align = "center";
			td.bgColor = "#ffffff";
			td.innerHTML = "<input type='button' value='删除' style='border:1px soild #000000;font-size:10px;' onclick='javascript:JesAttach.delAttachRow(this,\""+oAttachment.id+"\",\""+oAttachment.attachname+"\");'/>";
		}else{
			var tr = tableEle.insertRow(tableEle.rows.length);
			td = tr.insertCell(tr.cells.length);
			td.align = "center";
			td.height = 30;
			td.bgColor = "#ffffff";
			td.innerHTML = "<a href='../../download.shtml?uploadName="+oAttachment.attachname+"&fileName="+oAttachment.attacholdname+"&isTemp=true'>"+oAttachment.attacholdname+"</a>";

			td = tr.insertCell(tr.cells.length);
			td.innerHTML = oAttachment.attachsize;

			td = tr.insertCell(tr.cells.length);
			td.innerHTML = JESUtil.formatDate(new Date());

			td = tr.insertCell(tr.cells.length);
			td.innerHTML = "<input type='button' value='删除' style='border:1px soild #000000;font-size:10px;' onclick='javascript:JesAttach.delAttachRow(this,\""+oAttachment.id+"\",\""+oAttachment.attachname+"\");'/>";
		}
    }catch(e){
		alert("获得附件信息失败，请联系管理员。");
	}
}
</script>

<style type="text/css">
body{font: 11px Arial;margin-left: 0px;margin-right: 0px;margin-bottom: 0px;background-image: url(images/g_24.jpg);}
table{font-family:Verdana,Arial,宋体;font-size:12px;FILTER: progid:DXImageTransform.Microsoft.Shadow(direction=135,color=#999999,strength=3);}
input{border:1px soild #000000;font-family:Verdana,Arial,宋体;font-size:12px;padding:2px;}
</style>
<title>附件上传</title>
</head>
<%
	String attachType = request.getParameter("attachType");
    if(attachType == "" || "".equals(attachType) || attachType == null) attachType = "business";
%>
<body>
<br>
<center>
<form name="form1" method="post" action="<%=request.getContextPath()%>/upload.shtml?attachType=<%=attachType%>" enctype="multipart/form-data" onsubmit="" target="response_iframe">
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="1" class="kuang3" style="margin-top:20px">
	<tr>
		<td bgcolor="#8abb2d">
			<table width="100%" border="0" cellpadding="5" cellspacing="1">
				<tr><td align="center" bgcolor="#f5fbec" colspan="2"><strong>附件上传</strong></td></tr>
	  			<tr>
	    			<td align="center" bgcolor="#f5fbec">请选择附件</td>
	    			<td bgcolor="#ffffff"><input type="file" size="40" name="attachfile"></td>
	  			</tr>
	  			<tr align="center" bgcolor="#ffffff">
		    		<td colspan="2">
						<input type="button" name="ok" name="ok" value="确 定" class="button" onclick="JesUpload.doUpload();">&nbsp;&nbsp;
						<input type="button" name="cencel" name="cencel" value="关 闭" class="button" onclick="JESUtil.closeWin();">
					</td>
	    		</tr>
			</table>
		</td>
	</tr>
</table>
<div id="procBar" align="left" style="width:400px; height:180px; border:0px; background-image:url(images/bg.gif);display:none;position:absolute; top:10px;left:100px;">
	<div id="theMeter">
		<div id="procBarTxt" align="center" style="width:220px; height:30px; margin-left:157px; margin-top:70px; font-size:12px;"></div>
		<div id="procBarBox" style="width:216px; margin-left:160px; margin-top:10px; background-image: url(images/white.gif);height: 12px; background-repeat:no-repeat;">
			<div id="procBarBoxCont" style="background-image:url(images/blue1.gif); width:0px; height:12px; background-repeat:repeat-x;"></div>
  	    </div>
	</div>
</div>
</form>
</center>
<iframe id="response_iframe" name="response_iframe" style="display:none"></iframe>
</body>
</html>